package com.woniuxy.core.mapper;

import com.woniuxy.entity.OrderRun;
import com.woniuxy.entity.ShopOrder;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface OrderRunMapper {
    @Insert("insert into order_run(order_number,user_id,take_user_id,order_status," +
            "create_time,update_time,total_amount,receiver_name,receiver_phone," +
            "receiver_address,coupon_id,run_id) values (#{orderRun.orderNumber},#{orderRun.userId}," +
            "#{orderRun.takeUserId},#{orderRun.orderStatus},NOW(),NOW(),#{orderRun.totalAmount}," +
            "#{orderRun.receiverName},#{orderRun.receiverPhone},#{orderRun.receiverAddress}," +
            "#{orderRun.couponId},#{orderRun.runId})")
    void createOrderRun(@Param("orderRun") OrderRun orderRun);
    @Select("select * from shop_order where run_number = #{runNumber}")
    ShopOrder getOrderByRN(String runNumber);
    @Update("update all_run set state = 3 where run_number = #{runNumber}")
    void updateStateToPay(String runNumber);
}
